Coloring a linear space with a unique value for each coordinate point is rather simple. Color hue is a one-dimensional quantity with a finite range:

0.51

The entire range or any part of it may be spread along a line of any length, providing a unique color for each point. It can also be used to color rays emerging from an origin, assigning a unique value to each radius of a filled circle, which is useful for visualizing complex variables. But it cannot be applied directly to give a unique color to every point of a sphere, as this is a two-dimensional surface.

Each point on a sphere naturally has a unique set of coordinates: these cannot be used directly to assign a unique color, since coordinate values can become negative and RGB color components never are. One could of course use the absolute value of coordinates to avoid this problem, but the resulting color scheme would be identical on opposite poles of the sphere.

The goal is to assign the primary colors red, green and blue to the x, y and z coordinate axes, with these exact three colors not used on the remainder of the sphere. The simplest way to achieve the latter is to assign their respective additive opposites to the negative axes for each variable, to wit the colors cyan, magenta and yellow. Interpolation among these six points will provide a unique color for each point on the sphere.

This can be explored with colored squares initially representing these six poles. Start with with each primary color and its opposite as endpoints and add one more color in between the two. For three possible choices of display one has

The second color in each of the two left-most columns has been chosen to satisfy the progression xyzx, that is, red → green → blue → red. The reason for this will be made clear.

This initial data can then be expanded by averaging first between columns then between rows. A first iteration of the procedure gives

the second iteration produces

and the third iteration has the result

The process can be continued for more finely grained data, but the idea should already be clear.

But how does one wrap this colormap onto a sphere? The first element in each column represents a primary pole, so that all of these points are equivalent in location on the sphere. The same holds for the last element in each column, all of which are equivalent to the opposite pole of the sphere. Moving in a row across the columns then corresponds to moving around the sphere, with initial colors chosen to ensure this occurs in a counterclockwise direction.

The appropriate variables to describe such a system are not coordinates of points, but the angular variables determining the coordinates. Moving down a column is the increasing direction of the standard spherical variable θ, while moving along a row in the given counterclockwise direction is the standard spherical variable φ. This colormap represents a simple linear interpolation in both of these two angular variables between initial reference points.

To determine the explicit functional dependence of the colormap on angular variables, first plot the values of individual components. Using the most finely grained red/cyan dataset, the values down columns are

and the values across rows are

Not surprisingly the breaks in lines all occur at multiples of π/2 , which are the locations of poles on the sphere. Even more finely grained data would not change the nature of these functions, since they are as expected linear interpolations between these poles. Since the first of these two graphics has fewer moving parts, it will be used to determine the complete function.

The explicit functions are simplest in terms of the scaled variables Θ= 2θπ and Φ= 2φπ , which will be used for variable domains as well. In terms of these scaled variables, the first interactive graphic becomes

When the midpoints of these three graphs vary, they are linear functions of Φ over appropriate intervals. For the red component the explicit expressions are

Φ-1 , 1Φ2 4-Φ , 3Φ4

for the green component

1-Φ , 0Φ1 Φ-2 , 2Φ3

and for the blue component

Φ , 0Φ1 3-Φ , 2Φ3

The complete functional forms can now be easily determined from the graphic:

R(Θ,Φ) ={ 1-Θ 0Θ1 0Φ1 0 1Θ2 0Φ1 (Φ-2)Θ +1 0Θ1 1Φ2 (Φ-1) (2-Θ) 1Θ2 1Φ2 1 0Θ1 2Φ3 2-Θ 1Θ2 2Φ3 (3-Φ)Θ +1 0Θ1 3Φ4 (4-Φ) (2-Θ) 1Θ2 3Φ4

G(Θ,Φ) ={ (1-Φ)Θ 0Θ1 0Φ1 Φ(Θ-2) +1 1Θ2 0Φ1 0 0Θ1 1Φ2 Θ-1 1Θ2 1Φ2 (Φ-2)Θ 0Θ1 2Φ3 (3-Φ) (Θ-1) +Φ-2 1Θ2 2Φ3 Θ 0Θ1 3Φ4 1 1Θ2 3Φ4

B(Θ,Φ) ={ ΦΘ 0Θ1 0Φ1 (Φ-1) (1-Θ) +Φ 1Θ2 0Φ1 Θ 0Θ1 1Φ2 1 1Θ2 1Φ2 (3-Φ)Θ 0Θ1 2Φ3 (Φ-2) (Θ-1) +3-Φ 1Θ2 2Φ3 0 0Θ1 3Φ4 Θ-1 1Θ2 3Φ4

These expressions may look complicated, but they are just simple linear functions over eight different angular regions.

The explicit forms can now be used to define piecewise functions of the two angular variables. As a check of the process, these will be compared to the exact values for the red/cyan dataset. With piecewise colors optionally overlaid in lighter shades, the first interactive graphic is

while the second is

The exact match between data and derived functions verifies the explicit statements of the latter.

There is one more wrinkle to the problem. The functions for color components are dependent on angular variables, not coordinates, so one must translate between the two. For the red/cyan dataset with the red pole on the positive x-axis, Cartesian coordinates are given by

x=cosθ y=sinθcosφ z=sinθsinφ

which is nonstandard but consistent with the dataset. The mathematical statement of inversion is simple to write,

θ=cos1x φ=tan1 zy

but in practical numerical application a bit tricky. The expression for θ is fine as is, but for φ one must add factors of π according to

y>0 z>0 0 y<0 z>0 π y<0 z<0 π y>0 z<0 2π

in order to obtain a continuous numerical value from zero to 2π . These functions are included in the underlying code along with the piecewise color component functions.

And now for the pièce de résistance! The uniquely colored sphere looks thusly:

Unlike simple colored squares, the appearance of this object depends as well on the curvature of the surface and intensity of ambient light. While it may seem a bit different from the flat colorations above, rest assured each coordinate point on the sphere has its own unique color.

The process for deriving functions from the red/cyan dataset can also be employed to derive similar functions from the green/magenta and blue/yellow datasets. This would lead to different explicit expressions and coordinate transformations, but the end result would have the same appearance.

A previous presentation concerning geodesics on surfaces used the linear color scheme at the outset for rays of geodesics around a point on a two-dimensional surface. The color component functions developed in this presentation will be applied in a future one concerning geodesics in space to rays of geodesics around a point in three-dimensional space. Forward!


Uploaded 2026.08.25 analyticphysics.com